<?php

namespace app\api\controller;

use app\api\BaseController;
use app\admin\model\BaseModel; // 基础信息
use app\admin\model\HonorModel; // 荣誉信息
use app\admin\model\SheshiModel; // 基础设施
use app\admin\model\NongyeTotalModel; // 农业统计
use app\admin\model\NongyeFenbuModel; // 农业分布
use app\admin\model\JitiJingjiModel; // 集体经济
use app\admin\model\CunminShouruModel; // 村民收入
use app\admin\model\ProjectIntroModel; // 项目建设汇总
use app\admin\model\ProjectListModel; // 项目建设列表
use app\admin\model\CultureModel; // 文化活动
use app\admin\model\BangfuduixiangModel; // 帮扶对象
use app\admin\model\ZhongdianguanzhuModel; // 关注人群
use app\admin\model\YanglaoModel; // 养老服务


class Index extends BaseController
{
    public function index()
    {
        $id = $this->villageId;
        $base = BaseModel::where('village_id',$id)->find();

        $honor = HonorModel::where('village_id',$id)->select();

        $sheshi = SheshiModel::where('village_id',$id)->find();

        $nongyeTotal = NongyeTotalModel::where('village_id',$id)->find();

        $nongyeFenbu = NongyeFenbuModel::where('village_id',$id)->select();

        $jitiJingji = JitiJingjiModel::where('village_id',$id)->select();

        $cunminShouru = CunminShouruModel::where('village_id',$id)->select();

        $projectIntro = ProjectIntroModel::where('village_id',$id)->find();

        $projectList = ProjectListModel::where('village_id',$id)->select();

        $culture = CultureModel::where('village_id',$id)->select();

        $bangfuduixiang = BangfuduixiangModel::where('village_id',$id)->select();

        $zhongdianguanzhu = ZhongdianguanzhuModel::where('village_id',$id)->select();

        $yanglao = YanglaoModel::where('village_id',$id)->select();


        return json([
            'base' => $base,
            'honor' => $honor,
            'sheshi' => $sheshi,
            'nongyeTotal' => $nongyeTotal,
            'nongyeFenbu' => $nongyeFenbu,
            'jitiJingji' => $jitiJingji,
            'cunminShouru' => $cunminShouru,
            'projectIntro' => $projectIntro,
            'projectList' => $projectList,
            'culture' => $culture,
            'bangfuduixiang' => $bangfuduixiang,
            'zhongdianguanzhu' => $zhongdianguanzhu,
            'yanglao' => $yanglao,
        ]);



    }

    public function hello($name = 'ThinkPHP8')
    {

    }
}
